﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Resources.cs" company="" />
// <summary>
//   Application resources.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Xompare
{
    using System;
    using System.Drawing;
    using System.Reflection;

    using Utilities;

    /// <summary>
    /// Bitmap resources.
    /// </summary>
    public static class BitmapResources
    {
        #region Images

        private static readonly Lazy<Image> s_xElementImage =
            new Lazy<Image>(() => Image.FromStream(AssemblyInfo.GetEmbeddedObjectStream(Assembly.GetExecutingAssembly(), "XElementImage.bmp")),
                true);

        private static readonly Lazy<Image> s_xAttributeImage =
            new Lazy<Image>(() => Image.FromStream(AssemblyInfo.GetEmbeddedObjectStream(Assembly.GetExecutingAssembly(), "XAttributeImage.bmp")),
                true);

        #endregion

        #region Image getters

        /// <summary>
        /// Gets the tree image for an XML element.
        /// </summary>
        public static Image XElementTreeImage
        {
            get
            {
                return s_xElementImage.Value;
            }
        }

        /// <summary>
        /// Gets the tree image for an XML attribute.
        /// </summary>
        public static Image XAttributeTreeImage
        {
            get
            {
                return s_xAttributeImage.Value;
            }
        }

        #endregion
    }

    /// <summary>
    /// Colors used in the display of XML files comparison.
    /// </summary>
    public class XDiffColors
    {
        #region Tree node colors

        private static readonly Color s_naturalForeColor = Color.Black;
        private static readonly Color s_naturalBackColor = Color.White;
        private static readonly Color s_groupVarianceColor = Color.FromArgb(0xFF, 0xCA, 0xFA, 0xFF);
        private static readonly Color s_onlyOriginalColor = Color.Red;
        private static readonly Color s_onlyTargetColor = Color.FromArgb(0xFF, 0, 0xD0, 0);
        private static readonly Color s_differentColor = Color.MediumPurple;
        private static readonly Color s_counterPartDiffColor = Color.Yellow;
        private static readonly Color s_searchMark = Color.DarkOrange;
        private static readonly Color s_blockAdded = Color.FromArgb(0xFF, 0xEB, 0xFF, 0xE3);
        private static readonly Color s_blockRemoved = Color.FromArgb(0xFF, 0xFF, 0xE2, 0xE2);

        #endregion

        #region Color getters

        /// <summary>
        /// Gets the fore-color given to a node which has no representation of difference information.
        /// </summary>
        public static Color NaturalForeColor
        {
            get
            {
                return s_naturalForeColor;
            }
        }

        /// <summary>
        /// Gets the back-color given to a node which has no representation of difference information.
        /// </summary>
        public static Color NaturalBackColor
        {
            get
            {
                return s_naturalBackColor;
            }
        }

        /// <summary>
        /// Gets the back-color given to a node which has some of its decendents marked as a various types of differences.
        /// </summary>
        public static Color GroupVarianceColor
        {
            get
            {
                return s_groupVarianceColor;
            }
        }

        /// <summary>
        /// Gets the fore-color of a tree node marked as belonging only to the original side of the comparison.
        /// </summary>
        public static Color OnlyOriginalColor
        {
            get
            {
                return s_onlyOriginalColor;
            }
        }

        /// <summary>
        /// Gets the fore-color of a tree node marked as belonging only to the target side of the comparison.
        /// </summary>
        public static Color OnlyTargetColor
        {
            get
            {
                return s_onlyTargetColor;
            }
        }

        /// <summary>
        /// Gets the fore-color of a tree node marked as belonging to both sides of the comparison, only they differ.
        /// </summary>
        public static Color DifferentColor
        {
            get
            {
                return s_differentColor;
            }
        }

        /// <summary>
        /// Gets the back-color of a tree node marking it is the difference counter-part of the node selected by the user on the other side of the comparison.
        /// </summary>
        public static Color CounterPartDiffColor
        {
            get
            {
                return s_counterPartDiffColor;
            }
        }

        /// <summary>
        /// Gets the back-color of a tree node which is a search result.
        /// </summary>
        public static Color SearchMark
        {
            get
            {
                return s_searchMark;
            }
        }

        /// <summary>
        /// Gets the back-color of a tree node which some ancestor was added.
        /// </summary>
        public static Color BlockAdded
        {
            get
            {
                return s_blockAdded;
            }
        }

        /// <summary>
        /// Gets the back-color of a tree node which some ancestor was removed.
        /// </summary>
        public static Color BlockRemoved
        {
            get
            {
                return s_blockRemoved;
            }
        }

        #endregion
    }
}
